#!/usr/bin/ksh

###Script to add HACMP users on AIX systems###

###List of HACMP cluster members to add the users on###
set -A HOSTLIST node1 node2 node3

[[ -z "$1" ]] || [[ -z "$2" ]] &&  echo "SYNTAX: $0 Username UserID" && exit 1

/usr/es/sbin/cluster/sbin/cl_mkuser id=$2 pgrp='maintgrp' su='false' loginretries='3' pwdwarntime='14' histsize='3' histexpire='6' maxage='12' minlen='6' minother='1' maxrepeats='4' mindiff='4' $1

if [ $? = 0 ]
	then 
	sleep 1
	/usr/es/sbin/cluster/sbin/cl_chpasswd -cspoc -f -r $1
fi


for x in ${HOSTLIST[*]}
	do
	ssh $x "pwdadm -c $1"
done


exit 0
